package com.edu.cloud.facade.web;

import com.edu.cloud.facade.feign.IHttpApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/http/")
public class HttpController {

    @Autowired
    IHttpApi hapi;

    @GetMapping("/hello")
    public String hello(){
        return "hello:"+hapi.hello();
    }

    @GetMapping("/echo")
    public String echo(){
        return "echo:"+hapi.echo("echo test");
    }

    @GetMapping("/echo1s")
    public String echo1s() throws InterruptedException {
        return "echo1s:"+hapi.echo1s("echo test");
    }

    @GetMapping("/echo2s")
    public String echo2s() throws InterruptedException {
        return "echo2s:"+hapi.echo2s("echo test");
    }

    @GetMapping("/echo3s")
    public String echo3s() throws InterruptedException {
        return "echo3s:"+hapi.echo3s("echo test");
    }

    @GetMapping("/echo2")
    public String echo2(){
        return "echo:"+hapi.echo2("abc","33");
    }

    @GetMapping("/echoPost")
    public String echoPost(){

        return "echo:"+hapi.echoPost("postname","22");
    }

    @GetMapping("/echoPostPojo")
    public String echoPostPojo(){
        return "echo:"+hapi.echoPost("pojoname","34");
    }
}
